package testes;

import org.junit.*;

import agenda.*;

public class FormaDeContatoTest {
        
        private FormaDeContato skype, telefone, email;
        
        @Before
        public void setUp() throws Exception {
                skype = new Skype("Dugs");
                telefone = new Telefone("12345678", "random");
                email = new Email("dugs@gmail.com");
        }

        @Test
        public void testGetEndereco() {
                Assert.assertEquals("Dugs", skype.getEndereco());
                Assert.assertEquals("12345678", telefone.getEndereco());
                Assert.assertEquals("dugs@gmail.com", email.getEndereco());
        }
        
        @Test
        public void testGetComentario() {
                Assert.assertNull(skype.getComentario());
                Assert.assertEquals("random", telefone.getComentario());
                Assert.assertNull(email.getComentario());
        }
        
        @Test
        public void testGetTipo() {
                Assert.assertEquals("Skype", skype.getTipo());
                Assert.assertEquals("Telefone", telefone.getTipo());
                Assert.assertEquals("E-mail", email.getTipo());
        }
        
        @Test
        public void testSetComentario() {
                skype.setComentario("Bla");
                Assert.assertEquals("Bla", skype.getComentario());
                
                telefone.setComentario("ois");
                Assert.assertEquals("ois", telefone.getComentario());
                
                email.setComentario("whaat");
                Assert.assertEquals("whaat", email.getComentario());
        }
        
        @Test
        public void testSetEndereco() throws Exception {
                skype.setEndereco("Bobs");
                Assert.assertEquals("Bobs", skype.getEndereco());
                
                telefone.setEndereco("123");
                Assert.assertEquals("123", telefone.getEndereco());
                
                email.setEndereco("bobs@gmail.com");
                Assert.assertEquals("bobs@gmail.com", email.getEndereco());
        }
        
        @Test
        public void testToString() {
                Assert.assertEquals("Skype: Dugs", skype.toString());
                Assert.assertEquals("Telefone: 12345678 random", telefone.toString());
                Assert.assertEquals("E-mail: dugs@gmail.com", email.toString());
        }

}
